<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
    <title id="ju137116">gpscp</title>
    <body>
        <p>Copies files between multiple hosts at once.</p>
        <section id="section2">
            <title>Synopsis</title>
            <codeblock>gpscp { -f &lt;hostfile_gpssh> | -h &lt;hostname> [-h &lt;hostname> ...] } 
      [-J &lt;character>] [-v] [[&lt;user>@]&lt;hostname>:]&lt;file_to_copy> [...]
      [[&lt;user>@]&lt;hostname>:]&lt;copy_to_path>

gpscp -? 

gpscp --version</codeblock>
        </section>
        <section id="section3">
            <title>Description</title>
            <p>The <codeph>gpscp</codeph> utility allows you to copy one or more files from the
                specified hosts to other specified hosts in one command using SCP (secure copy). For
                example, you can copy a file from the Greenplum Database master host
                to all of the segment hosts at the same time.</p>
            <p>To specify the hosts involved in the SCP session, use the <codeph>-f</codeph> option
                to specify a file containing a list of host names, or use the <codeph>-h</codeph>
                option to name single host names on the command-line. At least one host name
                    (<codeph>-h</codeph>) or a host file (<codeph>-f</codeph>) is required. The
                    <codeph>-J</codeph> option allows you to specify a single character to
                substitute for the <varname>hostname</varname> in the <codeph>copy from</codeph> and
                    <codeph>copy to</codeph> destination strings. If <codeph>-J</codeph> is not
                specified, the default substitution character is an equal sign (<codeph>=</codeph>).
                For example, the following command will copy <codeph>.bashrc</codeph> from the local
                host to <codeph>/home/gpadmin</codeph> on all hosts named in
                    <codeph>hostfile_gpssh</codeph>:</p>
            <codeblock>gpscp -f hostfile_gpssh .bashrc =:/home/gpadmin</codeblock>
            <p>If a user name is not specified in the host list or with
                    <varname>user</varname><codeph>@</codeph> in the file path,
                    <codeph>gpscp</codeph> will copy files as the currently logged in user. To
                determine the currently logged in user, do a <codeph>whoami</codeph> command. By
                default, <codeph>gpscp</codeph> goes to <codeph>$HOME</codeph> of the session user
                on the remote hosts after login. To ensure the file is copied to the correct
                location on the remote hosts, it is recommended that you use absolute paths.</p>
            <p>Before using <codeph>gpscp</codeph>, you must have a trusted host setup between the
                hosts involved in the SCP session. You can use the utility
                    <codeph>gpssh-exkeys</codeph> to update the known host files and exchange public
                keys between hosts if you have not done so already.</p>
        </section>
        <section id="section4">
            <title>Options</title>
            <parml>
                <plentry>
                    <pt>-f <varname>hostfile_gpssh</varname></pt>
                    <pd>Specifies the name of a file that contains a list of hosts that will
                        participate in this SCP session. The syntax of the host file is one host per
                        line as follows:</pd>
                    <pd>
                        <codeblock>&lt;hostname&gt;</codeblock>
                    </pd>
                </plentry>
                <plentry>
                    <pt>-h <varname>hostname</varname></pt>
                    <pd>Specifies a single host name that will participate in this SCP session. You
                        can use the <codeph>-h</codeph> option multiple times to specify multiple
                        host names.</pd>
                </plentry>
                <plentry>
                    <pt>-J <varname>character</varname></pt>
                    <pd>The <codeph>-J</codeph> option allows you to specify a single character to
                        substitute for the <varname>hostname</varname> in the <codeph>copy
                            from</codeph> and <codeph>copy to</codeph> destination strings. If
                            <codeph>-J</codeph> is not specified, the default substitution character
                        is an equal sign (<codeph>=</codeph>).</pd>
                </plentry>
                <plentry>
                    <pt>-v (verbose mode)</pt>
                    <pd>Optional. Reports additional messages in addition to the SCP command
                        output.</pd>
                </plentry>
                <plentry>
                    <pt><varname>file_to_copy</varname></pt>
                    <pd>Required. The file name (or absolute path) of a file that you want to copy
                        to other hosts (or file locations). This can be either a file on the local
                        host or on another named host.</pd>
                </plentry>
                <plentry>
                    <pt><varname>copy_to_path</varname></pt>
                    <pd>Required. The path where you want the file(s) to be copied on the named
                        hosts. If an absolute path is not used, the file will be copied relative to
                            <codeph>$HOME</codeph> of the session user. You can also use the equal
                        sign '<codeph>=</codeph>' (or another character that you specify with the
                            <codeph>-J</codeph> option) in place of a <varname>hostname</varname>.
                        This will then substitute in each host name as specified in the supplied
                        host file (<codeph>-f</codeph>) or with the <codeph>-h</codeph> option.</pd>
                </plentry>
                <plentry>
                    <pt>-? (help)</pt>
                    <pd>Displays the online help.</pd>
                </plentry>
                <plentry>
                    <pt>--version</pt>
                    <pd>Displays the version of this utility.</pd>
                </plentry>
            </parml>
        </section>
        <section id="section5">
            <title>Examples</title>
            <p>Copy the file named <codeph>installer.tar</codeph> to <codeph>/</codeph> on all the
                hosts in the file <codeph>hostfile_gpssh</codeph>.</p>
            <codeblock>gpscp -f hostfile_gpssh installer.tar =:/</codeblock>
            <p>Copy the file named <varname>myfuncs.so</varname> to the specified location on the
                hosts named <codeph>sdw1</codeph> and <codeph>sdw2</codeph>:</p>
            <codeblock>gpscp -h sdw1 -h sdw2 myfuncs.so =:/usr/local/greenplum-db/lib</codeblock>
        </section>
        <section>
            <title>See Also</title>
            <p><xref href="gpssh.xml#topic1"/>, <xref href="gpssh-exkeys.xml#topic1"/></p>
        </section>
    </body>
</topic>
